<include file="../Public/_top" />
<script  type="text/javascript" src="__THEME__/js/rcalendar.js" ></script>
<style>
#rcalendar{font:14px Microsoft YaHei,SimSun,Arial !important}
</style>
<div class="content">
  <div class="wrap">
  <include file="./_left" />
    <div class="con_main">
      <div class="con_tit">
        <ul class="con_link">
          <li><a href="{:U('public/TestData/TestData')}">已测试</a></li>
          <li class="on"><a href="javascript:;">修改测试</a></li>
        </ul>
      </div>
      <div class="con_tit">基本信息</div>
      <div class="con_box">
        <ul class="test_list">
          <li>
            <div class="test_list_n">测试年份：</div>
            <div class="test_list_i" style="font-size:16px;">{$data.year}年</div>
          </li>
          <li>
            <div class="test_list_n">测试日期：</div>
            <div class="test_list_i" style="font-size:16px;">{$data.date}</div>
          </li>
          <li>
            <div class="test_list_n">所属年级：</div>
            <div class="test_list_i" style="font-size:16px;">{$data.class_type}</div>
          </li>
          <li>
            <div class="test_list_n">所属班级：</div>
            <div class="test_list_i" style="font-size:16px;">{$data.class_name}</div>
          </li>
          <li>
            <div class="test_list_n">学生姓名：</div>
            <div class="test_list_i" style="font-size:16px;">{$data.stu.stu_name}</div>
          </li>
          <li>
            <div class="test_list_n">测试次数：</div>
            <div class="test_list_i" style="font-size:16px;">第 {$data.test_number} 次</div>
          </li>
        </ul>
      </div>
      <div class="con_tit">身体信息</div>
      <div class="con_box">
        <ul class="test_list">
          <li>
            <div class="test_list_n">来园方式：</div>
            <div class="test_list_i" style="font-size:16px;">
              <if condition="$data['modes_transportation'] eq 1">走路</if>
              <if condition="$data['modes_transportation'] eq 2">坐车</if>
            </div>
          </li>
          <li>
            <div class="test_list_n">出生状况：</div>
            <div class="test_list_i" style="font-size:16px;">
              <if condition="$data['stu']['birth_condition'] eq 1">顺产</if>
              <if condition="$data['stu']['birth_condition'] eq 2">剖腹产</if>
            </div>
          </li>
          <volist name="test_project" id="project">
            <li>
              <div class="test_list_n">{$project.project_name}：</div>
                <div class="test_list_i">
                <input type="text" id="{$project.english_name}" <if condition="$project['unit'] neq null"> placeholder="单位：{$project.unit}"</if> 
                <?php 
                $keyName=array_keys($data);
                foreach ($keyName as $key => $value) {
                  if($project['english_name']==$value){
                    echo "value='".$data[$value]."'";
                  } 
                }
               ?>>
                </div>
                <if condition="($project['project_id']  neq 7) and ($project['project_id']  neq 8)">
                  <input type="hidden" id="img{$project.project_id}" value="{$project.project_img}">
                  <div class="test_list_w" style="cursor:pointer;" onclick="showImg({$project['project_id']});">测试方法</div>
                </if>
            </li>
          </volist>
        </ul>
      </div>
      <div class="action_link tc">
        <input type="hidden" id="test_id" value="{$data.test_id}">
        <a class="dowm" href="javascript:doSaveTest();">修改</a>
        <a href="javascript:reset();">重置</a>
      </div>
    </div>
  </div>
</div>
<div class="pop_wrap" id="pop_wrap" style="display:none;">
  <div class="pop_box" style="width:1000px;margin-left:-500px;" id="imgbody">
    <div class="pop_head"><a class="close" href="javascript:close();">X</a>测试方法</div>
    <div class="pop_body" style="margin-top:-50px;">
      <img src="" id="img">
    </div>
  </div>
</div>
<script>
$(window).scroll(function (){
    windowScrollUpload(this);
});
function windowScrollUpload(obj){
  $('#pop_wrap').css({
    'top': "-"+$(obj).scrollTop()+'px'
  });
  $('#imgbody').css({
    'top':($(obj).scrollTop()<200 ? 200 : "-"+$(obj).scrollTop())+'px'
  });
}
function reset(){
  $('input').val(""); 
}
function close(){
  $("#pop_wrap").css("display","none");
}
function showImg(id){
  var top=$(document).scrollTop()*1+50*1+"px";
  $("#imgbody").css("top",top);
  var url="<?php echo __THEME__ ?>"+"/images/"+$("#img"+id).val();
  document.getElementById("img").src=url;
  $("#pop_wrap").css("display","block");
}
function doSaveTest(){
  var test_id=$("#test_id").val();
  var balanceBeam=$("#balanceBeam").val();
  var continuousJump=$("#continuousJump").val();
  var tennis_throw=$("#tennis_throw").val();
  var standing_long_jump=$("#standing_long_jump").val();
  var flexion=$("#flexion").val();
  var reentry_run=$("#reentry_run").val();
  var vision_right=$("#vision_right").val();
  var vision_left=$("#vision_left").val();
  var skinfold_abdomen=$("#skinfold_abdomen").val();
  var skinfold_shoulder_armor=$("#skinfold_shoulder_armor").val();
  var skinfold_upper_arm=$("#skinfold_upper_arm").val();
  var heart_rate=$("#heart_rate").val();
  var sit_height=$("#sit_height").val();
  var weight=$("#weight").val();
  var height=$("#height").val();
  var chest=$("#chest").val();
  $.ajax({
    type: "POST",
    url:"{:U('public/TestData/doSaveTest')}",
    data:"test_id="+test_id+"&balanceBeam="+balanceBeam+"&continuousJump="+continuousJump+"&tennis_throw="+tennis_throw+"&standing_long_jump="+standing_long_jump+"&flexion="+flexion+"&reentry_run="+reentry_run+"&vision_right="+vision_right+"&vision_left="+vision_left+"&skinfold_abdomen="+skinfold_abdomen+"&skinfold_shoulder_armor="+skinfold_shoulder_armor+"&skinfold_upper_arm="+skinfold_upper_arm+"&heart_rate="+heart_rate+"&sit_height="+sit_height+"&weight="+weight+"&height="+height+"&chest="+chest,
    success:function(data){
      if(isNaN(data)){
        alert(data);
      }else{
        window.location.href="{:U('public/TestData/TestData')}";
      }
    }
  });
}
  function selectGrade(){
    var grade=$("#grade").val();
    if(grade!=""){
      $.ajax({
        type: "GET",
        url:"{:U('public/TestData/getClass')}",
        data:"class_type="+grade,
        dataType:"json",
        success:function(data){
          $("#class").html("");
          $("#class").append("<option value=''>--------请选择--------</option>");
          $.each(data,function(i,item){
            $("#class").append("<option value='"+item.class_id+"'>"+item.class_name+"</option>");
          }); 
        }
      });
    }
  }
function selectClass(){
  var Class=$("#class").val();
  if(Class!=""){
    $.ajax({
      type: "GET",
      url:"{:U('public/TestData/getStu')}",
      data:"Class="+Class,
      dataType:"json",
      success:function(data){
        $("#stu").html("");
        $("#birth_condition").html("");
        $("#stu").append("<option value=''>--------请选择--------</option>");
        $.each(data,function(i,item){
          if(item.birth_condition==1){
            $("#birth_condition").html("顺产");
          }else{
            $("#birth_condition").html("剖腹产");
          }
          $("#stu").append("<option value='"+item.stu_id+"'>"+item.stu_name+"</option>");
        }); 
      }
    });
  }
}
</script>
<include file="../Public/_foot" />